﻿namespace JobButenko.Core
{
    using System;
    using System.Configuration;
    using System.Web.Mvc;
    using System.Web.Routing;

    using JobButenko.Models.BusinessLogicLayer;

    public class JobControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            var connectionString = ConfigurationManager.ConnectionStrings[1].ConnectionString;
            return Activator.CreateInstance(controllerType, new DataManager(connectionString)) as IController;
        }
    }
}